class Animal(object):
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def eat(self):
        print(self.name + " is eating")

    def sleep(self):
        print(self.name + " is sleeping")

class Cat(Animal):
    def catch_mouse(self):
        print(self.name + " is catching")

    # 扩展式重写父类方法
    def eat(self):
        super().eat()
        print(self.name + "正在吃鱼")

class Dog(Animal):
    def watch_door(self):
        print(self.name + " is watch_door")


class Xiaotianquan(Dog):
    def fly(self):
        print(self.name + " is flying")

    # 覆盖式重写父类方法
    def sleep(self):
        print(self.name + "已经睡很久了")

cat = Cat("小溪", 2)
dog = Dog("小狗", 3)
xiaotianquan = Xiaotianquan("小天", 5)
cat.eat()
cat.sleep()
cat.catch_mouse()
dog.eat()
dog.sleep()
dog.watch_door()
xiaotianquan.eat()
xiaotianquan.sleep()
xiaotianquan.watch_door()
xiaotianquan.fly()